package com.atguigu.r2dbc.config;

import com.atguigu.r2dbc.config.converter.BookAuthorConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.r2dbc.convert.R2dbcCustomConversions;
import org.springframework.data.r2dbc.dialect.MySqlDialect;
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;

/**
 * @author Jungle
 * @create 2024-01-16 11:35
 */
@EnableR2dbcRepositories //开启 R2dbc仓库功能  jpa
@Configuration
public class R2DbcConfiguration {


    @Bean
    public R2dbcCustomConversions r2dbcCustomConversions(){
        //把我们的转换器加入进去，效果新增了我们的Converter
        return R2dbcCustomConversions.of(MySqlDialect.INSTANCE,new BookAuthorConverter());
    }
}
